package com.durian.financial.api.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author zhouzhiyi
 * @Date 2022/6/26 10:24
 * @Description 还款方式枚举
 */
@Getter
public enum RepaymentEnum {

    MONTHLY(1,"按月还款"),SEASON(2,"按季还款"),PERIOD(3,"按租约周期支付");

    @EnumValue
    @JsonValue
    private final Integer index;
    private final String value;

    RepaymentEnum(Integer index, String value) {
        this.index = index;
        this.value = value;
    }

    /**
     * 获取还款方式枚举Map
     *
     * @return Map<Integer,String>
     */
    public static Map<Integer,String> getRepaymentEnumMap(){

        Map<Integer, String> map = new HashMap<>();

        for (RepaymentEnum temp : EnumSet.allOf(RepaymentEnum.class)) {

            map.put(temp.index,temp.value);
        }
        return map;
    }

}
